The present invention relates to displaying graphical image on a computer system and more particularly to a method and system for providing antialiasing of implicit edges while maintaining processing speed and using less memory.
A conventional computer graphics system can display graphical images of objects on a display. The display includes a plurality of display elements, known as pixels, typically arranged in a grid. In order to display objects, the conventional computer graphics system typically breaks each object into a plurality of polygons. A conventional system then renders the polygons in a particular order. For a three-dimensional scene, the opaque polygons are generally rendered from front to back as measured from the viewing plane of the display. Translucent polygons are desired to be rendered from back to front. Similarly, a two-dimensional scene can be displayed. In such a case, polygons are rendered based on their layer. Shallower layers occlude deeper layers.
Each of the polygons includes mathematically defined edges. When rendering an image, the conventional system often renders diagonal lines or polygon edges that are not perfectly horizontal or vertical. Because each pixel has finite physical dimensions, edges which are not horizontal or vertical may appear jagged. For example, consider each pixel to be a square. A diagonal line or edge rendered using the square pixels will appear jagged, similar to a staircase. This effect is known as aliasing.
Implicit edges are edges that are visible in a graphical image, but that are not explicitly defined. For example, in a graphical image, objects may intersect each other. The intersection appears as an edge that is not explicitly defined. Implicit edges are due to differences in depth values of the polygons whose intersection forms the implicit edge. The depth value can include the distance from the viewing plane, a w value, or layer order. The depth values at the implicit edge, the intersection of the polygons, should be virtually identical. However, slight differences in depth values of the polygons from one pixel to the next dictate which polygon is visible at a selected pixel. Because of these slight differences in depth values, the polygon considered to be visible can change from pixel to pixel. This creates the implicit edge. Each pixel still has a finite area. As a result, the implicit edge is also subject to aliasing.
In order to reduce aliasing, conventional systems perform antialiasing. Antialiasing helps reduce the effect that the physical dimension of the pixels has on the appearance of objects being displayed. Diagonal lines and edges appear smoother. It would be desirable if the antialiasing performed is also capable of providing antialiasing for implicit edges.
Some conventional systems utilize conventional supersampling in order to perform antialiasing for implicit edges. Supersamnpling is typically performed for a portion of the display, called a tile, or the entire display at a time. Each pixel in the tile or display is considered to be an Mxc3x97N matrix subpixels. Data for each polygon in the tile is evaluated at each subpixel. Thus, the depth value, color, texture, and other data for the polygon can differ in and is evaluated at each subpixel. Data for the subpixels in each pixel in the tile are combined to provide the data for each pixel in the tile. Because supersampling evaluates and combines depth values for subpixels, supersampling can help smooth out the staircasing effect on implicit edges. However, the system requires sufficient memory to retain data for the Mxc3x97N subpixels in each pixel in a tile to perform supersampling. Therefore, a large amount of memory is required. It must also be ensured that there are not artifacts at the seams between tiles. This slows processing. Furthermore, much more data is processed for each pixel in the display. Supersampling is thus computation intensive and relatively slow.
Some conventional systems address some of the problems in supersampling by performing adaptive supersampling. Adaptive supersampling first identifies areas where supersampling may be desired, for example at an implicit edge. Once the area of an implicit edge is identified, supersampling is performed for a tile in the region of the implicit edge. In areas where there are no implicit edges, supersampling is not performed. Although adaptive supersampling improves processing speed by reducing the areas subjected to supersampling, a large amount of memory is still required.
Accordingly, what is needed is a system and method that is capable of providing antialiasing for implicit edges and which consumes less memory. The present invention addresses such a need.
The present invention provides a method and system for providing antialiasing of a graphical image on a display from data describing at least one object. The display includes a plurality of pixels. The method and system comprise providing a plurality of fragments for the at least one object. A portion of the plurality of fragments intersects a pixel of the plurality of pixels. Each of the plurality of fragments includes a depth value, a slope of the depth value, and a portion of a corresponding pixel that is intersected. The method and system comprise calculating a plurality of subpixel depth values for a fragment of the plurality of fragments. The plurality of subpixel depth values is calculated using the depth value and the slope of the depth value of the fragment. The method and system comprise determining whether to store a portion of the fragment based on the plurality of subpixel depth values for the fragment and the indication of the extent the corresponding pixel is intersected by the fragment. The method and system also comprise storing the portion of the fragment if it has been determined that the portion of the fragment is to be stored. The method and system also comprise repeating the calculating, determining, and storing steps for each remaining fragment in the portion of the plurality of fragments. The method and system also comprise providing antialiased data for the pixel based on a second portion of the plurality of fragments that have been stored.
According to the system and method disclosed herein, the present invention can provide antialiasing for implicit edges. The antialiasing is provided without requiring a frame buffer or z-buffer. Furthermore, the present invention does not slow processing of the image by requiring an inordinate number of calculations.